package cn.iocoder.yudao.module.engine.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.StringArrayValuable;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

import java.util.Arrays;

@AllArgsConstructor
@ToString
public enum EnumInteractionType implements StringArrayValuable {
    CHAT("chat", "对话"),
    COMMAND("command", "指令"),
    SENSOR("sensor", "传感器"),

    ;

    public static final String[] ARRAYS = Arrays.stream(values())
            .map(EnumInteractionType::getValue)
            .toArray(String[]::new);

    /**
     * 类型
     */
    private final String value;
    /**
     * 类型名
     */
    private final String name;

    public static EnumInteractionType valueOf(Integer value) {

        return ArrayUtil.firstMatch(userType -> userType.getValue().equals(value), EnumInteractionType.values());
    }

    @Override
    public String[] array() {
        return ARRAYS;
    }

    @JsonValue
    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }
}
